<?php

    function _tvn_report_insert_data($table, $data) {
        return db_insert($table)->fields($data)->execute();
    }

    function tvn_report_update_field($rid, $values) {
        return db_update('tvn_reports')->fields($values)->condition('rid', $rid)->execute();
    }

    function tvn_report_get_data($status) {
        $query = db_select('tvn_reports', 'r')->extend('PagerDefault');
        $query->fields('r');
        $query->condition('r.status', $status);
        $query->limit(50);
        return $query->execute();
    }

    function tvn_report_get_report_by_id($rid) {
        return db_select('tvn_reports', 'r')->fields('r')->condition('r.rid', $rid)->execute()->fetchObject();
    }
